/*
 * @Descripttion:
 * @version:
 * @Author: congsir
 * @Date: 2025-10-26 23:22:26
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2025-11-19 23:04:09
 */
import { configureStore } from '@reduxjs/toolkit'
import recommends from '@/views/discover/c-views/recommend/store/recommends'
import counterReducer from './module/counter'
import {
  useSelector,
  TypedUseSelectorHook,
  useDispatch,
  shallowEqual
} from 'react-redux'

const store = configureStore({
  reducer: {
    counter: counterReducer,
    recommed: recommends
  }
})
type GetStateFnType = typeof store.getState
//函数的类型
//函数不单独放一行会eslit报错
type IRootState = ReturnType<GetStateFnType>
type DispatchType = typeof store.dispatch
//函数的返回值类型

//useAppSelector的hook函数调用签名
export const useAppSelector: TypedUseSelectorHook<IRootState> = useSelector
export const useAppDispatch: () => DispatchType = useDispatch
export const shallowEqualApp = shallowEqual
export default store
